<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?=isset($title) && !empty($title)?$title:'外賣店名稱'?></title>
<meta name="robots" content="all"/>
<meta name="keywords" content="<?=isset($keyword) && !empty($keyword)?$keyword:'外賣店名稱'?>">
<meta name="description" content="<?=isset($description) && !empty($description)?$description:'外賣店名稱'?>">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimal-ui">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="<?=isset($title) && !empty($title)?$title:'外賣店名稱'?>" />
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<link rel="shortcut icon" href="<?=base_url('themes/front/img/ico/favicon.png')?>">
<link rel="apple-touch-icon" href="<?=base_url('themes/front/img/ico/apple-touch-icon.png')?>">
<link rel="stylesheet" href="<?=base_url('themes/front/css/jquery.mobile-1.4.5.min.css')?>">
<link rel="stylesheet" href="<?=base_url('themes/front/css/main.css')?>">
<script src="<?=base_url('themes/front/js/jquery-1.11.1.min.js')?>"></script>
<script src="<?=base_url('themes/front/js/jquery.mobile-1.4.5.min.js')?>"></script>
<script src="<?=base_url('themes/front/js/jquery.sticky.js')?>"></script>
<script src="<?=base_url('themes/front/js/pageloading/jQuery.PageLoading.min.js')?>"></script>
<!--slideshow-->
<link type="text/css" rel="stylesheet" href="<?=base_url('themes/front/js/owl-carousel/owl.carousel.css')?>">
<link type="text/css" rel="stylesheet" href="<?=base_url('themes/front/js/owl-carousel/owl.slideshow.css')?>">
<style type="text/css">
  #product_content ul li .price-block span.number{padding:0px 20px;}
</style>
<script src="<?=base_url('themes/front/js/owl-carousel/owl.carousel.min.js')?>"></script>
<script>
$(document).on("pageshow", function() {
    $("#ordermenu").sticky({topSpacing:0});
});
</script>
<script>
  $(document).ready(function(){
    $.PadeLoading({  // Options
     'BgColor' : '#000000',
     //'BgIMG' : 'URLOfBackgroundImage',
     'BgInnerColor' : '#FFFFFF',
     'BorderColor' : '#FFFFFF',
     'ShadowColor' : '#FFFFFF',
     'LoaderIMG' : "<?=base_url('themes/front/js/pageloading/AjaxLoader.gif')?>",
     'zIndex' : 999
    });
  });
  $(window).load(function(){
     $.PadeLoaded();
  });
</script>
</head>
<body>
<!-- 首頁 -->
<div data-role="page" id="home">

  <?php $thumb_img=!empty($website_logo)?Imagelib::resize_thumb($website_logo,228,48):'themes/front/img/no-image.png';?>
  <div data-role="nav" class="nav">
    <!-- <div class="gap"></div> -->
    <div class="cart pull-right"><a href="#cart">訂單</a><i class="cart_total">0</i></div>
      <?php if(!empty($title)):?>
<!--           <span style="font-size: 20pt;height: 22px;vertical-align: middle;line-height:22px;"><?=$title?></span>
 -->      <?php endif;?>
      <img class="logo" src="<?=base_url($thumb_img)?>" title="<?=$title?>" alt="<?=isset($title) && !empty($title)?$title:'外賣店名稱'?>"/></a></p>
  </div><!-- nav -->
  <?php if(isset($banner1) && $banner1->num_rows()>0): ?>
  <div id="slideshow" class="owl-carousel owl-theme slideshow text-center">
  <?php if(!empty($banner1)&&$banner1->num_rows()>0): ?>
    <?php foreach($banner1->result_array() as $banner): ?>
    <?php 
    if(!empty($banner['images']) && strtolower(substr($banner['images'], -3)) == 'gif'){
          $thumb_banner=$banner['images'];
      }else{
         $thumb_banner=!empty($banner['images'])?Imagelib::resize_thumb($banner['images'],800,800):'themes/front/img/no-image.png';
      }
    
    ?>
    <div class="item">
      <a <?=!empty($banner['links'])?'href="'.$banner['links'].'"':''?>  title="<?=$banner['title']?>"><img src="<?=base_url($thumb_banner)?>" title="<?=$banner['title']?>" /></a>
    </div>
    <?php endforeach; ?>
  <?php else:?>
  <div class="m_message m_notice"><p><?=lang('sorry_no_data')?></p></div>
  <?php endif;?>
  </div><!--slideshow-->
  <?php endif;?>
  <?php if(isset($shop_close) && !empty($shop_close)):?>
  <div style="background:#FFF; padding:1em">
    <?php echo nl2br($shop_close)?>
  </div>
  <?php endif;?>

    <div role="main" class="ui-content">
        <?php if(isset($menu) && $menu->num_rows()>0):?>
        <?php foreach($menu->result_array() as $page):?>
        <?php $thumb_img=!empty($page['menu_icon'])?Imagelib::resize_thumb($page['menu_icon'],300,200):'themes/front/img/no-image.png';?>
        <p><a style="background: <?=$page['bg_color']?>"  <?=!empty($page['links'])?'href="'.$page['links'].'" ':''?> class="pure-button pure-button-primary pure-button-img">
            <?php if(!empty($page['title'])):?>
            <span style="font-size: 20pt;height: 22px;vertical-align: middle;line-height:22px;"><?=$page['title']?></span>
            <?php endif;?>
            <img src="<?=base_url($thumb_img)?>" title="<?=$page['title']?>"/></a></p>

        <?php endforeach;?>
        <?php endif;?>
    </div><!-- /content -->




  <div class="footer">
    <p>© <?php echo isset($copyright) ? $copyright:'外賣店名稱'?> .Created with <a href="#" title="PopFree Tech" target="_blank">PopFree Tech</a></p></div>
  </div><!-- /footer -->
</div>
<!-- 首頁結束 -->

<!-- 商品訂購 -->
<div data-role="page" id="order" data-theme="a">
  <div data-role="nav" class="nav">
    <a href="#home" data-direction="reverse" class="back pull-left">返回</a>
    <div class="cart pull-right"><a href="#cart">訂單</a><i class="cart_total">0</i></div>
    <h1>商品訂購</h1>
  </div><!-- /header -->
  <div class="search">
      <form name="_search">
        <input type="text" id="_search" class="search-input" name="keyword" placeholder="Search">
      </form>
      <i></i>
  </div>
  <?php if(isset($categorys) && !empty($categorys)):?>
  <div class="ordermenu-bg">
  <div id="ordermenu" class="ordermenu">
    <div class="item active"><a href="#category_all" class="product_type" category_id="">全部</a></div>
    <?php foreach($categorys as $list): ?>
    <div class="item"><a href="#category_<?=$list['id']?>" class="product_type" category_id="<?=$list['id']?>"><?=$list['title']?></a></div>
    <?php endforeach; ?>
  </div>
  </div>
  <?php endif; ?>
  <div id="product_content" role="main" class="ui-content" style="padding-bottom:100px;">
    <?php if(isset($lists) && $lists->num_rows()>0):?>
    <ul class="order-item my-simple-gallery" id="category_all" itemscope>
      <?php foreach($lists->result_array() as $list): ?>
      <?php $thumb_img=!empty($list['main_image']) && file_exists($list['main_image'])?Imagelib::resize_thumb($list['main_image'],100,100,FALSE):'themes/front/img/no-image.png'?>
      <?php $large_image=!empty($list['main_image']) && file_exists($list['main_image'])?Imagelib::resize_thumb($list['main_image'],450,450,FALSE):'themes/front/img/no-image-large.png';?>
      <li class="product product_<?=$list['id']?>" product_id="<?=$list['id']?>" data-aid='<?=$list['id']?>' data-price="<?php echo check_product_itemprice($list['id']) ? '1' : '0';?>">
        <div class="cover">
          <figure class="cover_son" itemprop="associatedMedia" itemscope>
          <a id="gethref" class="_gethref" href="<?=base_url($large_image)?>" itemprop="contentUrl" style="z-index:1" data-size="500x500">
            <img id="bigimages" class="_bigimages" src="<?=base_url($thumb_img)?>" itemprop="thumbnail" alt="Image description <?php check_product_itemprice();?>" width="100" height="100" /><i></i>
            <?php $photos = null;/*unserialize($list['photo']);*/if(!empty($photos)):?>
          
          <div style="position: absolute;width:85pt;height:25pt;line-height: 25pt;left: 0;bottom:-25px;z-index: 999;">
          <figure class="cover_son" itemprop="associatedMedia" itemscope>
          <?php foreach($photos as $image):?>
          <?php $pimage=set_value('photo',isset($image) && file_exists($image)?$image:'');?>
          <?php $show_img=!empty($pimage)?imagelib::resize_thumb($pimage,100,100):'themes/admins/img/no_image.png';?>
          <?php $big_img=!empty($pimage)?imagelib::resize_thumb($pimage,450,450):'themes/admins/img/no_image.png';?>

          <a href="#" data-link="<?=base_url($big_img)?>" >
            <img style="width:30px;height:30px;float:left;display: block;margin:3px;" class="edit_image img-polaroid" data-imgs="<?=base_url().$show_img?>" src="<?=base_url().$show_img?>" id="getimg"/>
          </a>
          <?php endforeach;?>
          </figure>
          </div>
      <?php endif;?>
          </a>
          </figure>
        </div>
        <p class="price-block">
            <?php if($list['old_price']):?>
            <s class=''>HK$<?=$list['old_price']?></s>
          <?php endif;?>
            <span class='price'>HK$<?=$list['price']?></span>
             <?php if(!empty($list['number'])):?>
              <span class="number">NO. <?=$list['number']?></span>
            <?php endif;?>
        </p>
        <p class="title"><?=$list['title']?></p>
       
        
        <p class="details" style="min-height: 50px;"><?=$list['introduction']?></p>
        <p class=" btn-block">
           <span class="btn add-cart-btn" type="button" ><span>加入購物車</span></span>
          <span class="select">
              <a class="minus" data-role="none" href="javascript:void(0)">-</a><input class="price" data-role="none" type="hidden" name="product_price" value="<?=$list['price']?>" /><input class="number" data-role="none" type="text" name="product_num" value="1" readonly="readonly"/><a class="add" data-role="none" href="javascript:void(0)">+</a>
          </span>
          <span class="btn detail-btn" type="button" ><span onclick="location.href='<?php echo base_url('home/detail')?>?product_id=<?=$list['id']?>'">介紹</span></span>
        </p>
      
      <span class="hot"><img class="icon-hot" src="https://www.lingsik.com/skin/frontend/default/theme589/images/icon-hot.png"></span>
      <div class="clearfix"></div>
      </li>
      <?php endforeach; ?>
    </ul>
    <?php else:?>
      <div class="nodata">沒有東西載入。</div>
    <?php endif;?>

    <?php if(isset($categorys) && !empty($categorys)):?>
      <?php foreach($categorys as $ctg):?>
      <ul class="order-item my-simple-gallery" id="category_<?=$ctg['id']?>" itemscope style="display:none">
        
      </ul>
      <?php endforeach;?>
    <?php endif;?>
    <div class="text-center" id="loading">
      <img src="<?=base_url('themes/front/img/ajax-loading.gif')?>">
    </div>
    <input type="hidden" id="category_id" name="category_id">
    <input type="hidden" id="object_ul" name="obj_ul" value="#category_all">
    <input type="hidden" id="ajax_waterfall" name="ajax_waterfall" value="<?=site_url('home/get_products')?>">
  </div><!-- /content -->
    <div class="flat-bottom" style="display: none;">
    <a href="#cart" class="pure-button pure-button-primary pure-button-img ui-link">
      <h3>已選 <span class="cart_total">0</span>，我選好了</h3>
    </a>
    </div>
</div>
<!-- 商品訂購結束 -->

<!-- 基本頁面 -->
<?php if(isset($page_list) && $page_list->num_rows()>0):?>
<?php foreach($page_list->result_array() as $page):?>
<div data-role="page" id="<?=$page['unique_url']?>" data-theme="a">
  <div data-role="nav" class="nav">
    <a href="#home" data-direction="reverse" class="back pull-left">返回</a>
    <div class="cart pull-right"><a href="#cart">訂單</a><i class="cart_total">0</i></div>
    <h1><?=$page['title']?></h1>
  </div><!-- /header -->
  <div role="main" class="ui-content">
    <div class="enter-content">
      <?php echo $page['content']?>
    </div>
  </div><!-- /content -->
  <div class="footer">
<p>© <?php echo isset($copyright) ? $copyright:'外賣店名稱'?> .Created with <a href="#" title="PopFree Tech" target="_blank">PopFree Tech</a></p>  </div><!-- /footer -->
</div>
<?php endforeach;?>
<?php endif;?>
<!-- 基本頁面結束 -->

<!-- 已選商品 -->
<div data-role="page" id="cart" data-theme="a">
  <div data-role="nav" class="nav">
    <a href="#order" data-direction="reverse" class="back pull-left">返回</a>
    <div class="cart pull-right"><a href="#cart">訂單</a><i class="cart_total">0</i></div>
    <h1>購物車</h1>
  </div><!-- /header -->
  <div role="main" class="ui-content"  style="padding-bottom:10px;">
    <div class="content" style="margin-bottom:0;">
      <div class="cart-info">
        <div class="pull-right">結算：$<b class="total_price">0.00</b></div>
        <div>數量：<b class="cart_total">0</b></div>
      </div>
      <ul id="cart_content" class="order-item my-simple-gallery" itemscope></ul>

      <div id="no_cart_product" class="no_cart_product"><p><img src="<?=base_url('themes/front/img/icon-nocart.png')?>" style="max-width:200px;"/></p>清單中沒有東西，快去點選吧！</div>
    </div>
    <div class="flat-bottom" style="position: none;">
          <div class="block-total">
            <p>數量：<span class="cart_total">0</span></p>
            <p>總計：<span>HK$<b class="total_price">0.00</b></span></p>
          </div>
        <div style="text-align:center;"><span><a href="#confirm" class="pure-button pure-button-primary pure-button-img">
          <h3>繼續結賬</h3>
        </a></span></div>
      </div>
  </div><!-- /content -->
  <div class="footer">
  <p>© <?php echo isset($copyright) ? $copyright:'外賣店名稱'?> .Created with <a href="#" title="PopFree Tech" target="_blank">PopFree Tech</a></p>  </div><!-- /footer -->
  </div>
</div>
<!-- 已選商品結束 -->

<!-- 已選商品 -->
<div data-role="page" id="confirm" data-theme="a">
  <div data-role="nav" class="nav">
    <a href="#cart" data-direction="reverse" class="back pull-left">返回</a>
    <div class="cart pull-right"><a href="#cart">訂單</a><i class="cart_total">0</i></div>
    <h1>已選商品</h1>
  </div><!-- /header -->
  <div role="main" class="ui-content" style="padding:0; margin:0">
    <form id="order_form" action="<?=site_url('home/order')?>" method="post">
    <input type="hidden" id="product_string" name="product_string">
    <input type="hidden" id="cart_total_price" name="cart_total_price">
    <input type="hidden" id="cart_total_num" name="cart_total_num">
    <div class="content">
      <div class="cart-info">
        <div class="pull-right">結算：$<b class="total_price">0.00</b></div>
        <div>數量：<b class="cart_total">0</b></div>
      </div><br/>
      <p>稱呼<span class="req">*必須</span></p>
      <p><input type="text" id="nickname" name="nickname"/></p>
      <p>聯絡電話<span class="req" id="contact_phone_msg">*必須</span></p>
      <p><input type="text" id="contact_phone" name="contact_phone"/></p>
      <p>方式<span class="req">*必須</span></p>
      <p>
        <select name="order_way" id="order_way">
          <option value="1">自取</option>
          <!-- <option value="2">送到上門</option> -->
          <?php if($payments):?>
            <?php foreach($payments as $payment):?>
            <option value="<?php echo $payment->code?>" selected><?php echo $payment->name?></option>
             <?php endforeach;?>
          <?php endif;?>
        </select>
      </p>
      <div id="logistics" style="display:">
        <p>送到地址</p>
        <p><input type="text" id="address" name="address"/></p>
        <p>送到時間</p>
        <p><input type="text" id="order_time" name="order_time" data-field="datetime" readonly /></p>
      </div>
      <p>備註</p>
      <p>
        <textarea name="comment"></textarea>
      </p>
      <div id="dtBox"></div>
      <?php if(isset($shop_status) && $shop_status==2):?>
      <p><?php echo isset($shop_close) && !empty($shop_close)?nl2br($shop_close):''?></p>
      <?php else:?>
      <p><h3><a href="#success" class="pure-button pure-button-primary pure-button-img">發送訂單</a></h3></p>
      <div class="text-center" id="order-loading" style="display:none">
        <img src="<?=base_url('themes/front/img/loading.gif')?>">
      </div>
      <?php endif;?>
    </div>
    </form>
  </div><!-- /content -->
  <div class="footer">
<p>© <?php echo isset($copyright) ? $copyright:'外賣店名稱'?> .Created with <a href="#" title="PopFree Tech" target="_blank">PopFree Tech</a></p>  </div><!-- /footer -->
</div>
<!-- 已選商品結束 -->

<!-- 成功提示 -->
<div data-role="page" id="success" data-theme="a">
  <div data-role="nav" class="nav">
    <h1>成功提示</h1>
  </div><!-- /header -->
  <div role="main" class="ui-content">
    <div class="enter-content">
      <br/>
      <p class="text-center success_msg" id="success_msg">落單提示</p>
      <br/>
      <p><h3><a href="#order" class="pure-button pure-button-primary pure-button-img">繼續選購</a></h3></p>
    </div>
  </div><!-- /content -->
  <div class="footer">
<p>© <?php echo isset($copyright) ? $copyright:'外賣店名稱'?> .Created with <a href="#" title="PopFree Tech" target="_blank">PopFree Tech</a></p>  </div><!-- /footer -->
</div>
<!-- 成功提示結束 -->

<!-- 訂單查詢 -->
<div data-role="page" id="search" data-theme="a">
  <div data-role="nav" class="nav">
    <a href="#home" data-direction="reverse" id="search_back" class="back pull-left">返回</a>
    <div class="cart pull-right"><a href="#cart">訂單</a><i class="cart_total">0</i></div>
    <h1>訂單查詢</h1>
  </div><!-- /header -->
  <div role="main" class="ui-content" style="padding:0; margin:0">
    <div class="content">
      <form id="form_search" action="<?=site_url('home/search')?>" method="post">
        <p><input type="text" name="order_number" id="search_order" placeholder="輸入訂單編號"></p>
        <p>
          <h3><a href="#search-btn" data-role="none" class="pure-button pure-button-primary pure-button-img">查詢</a></h3>
        </p>
      </form>
      <div id="search_result" class="search_result" style="display:none">
        <div id="search_detail">
          
        </div>
        <div id="search_product_list">
          <hr/>
          <h4>選購產品</h4>
          <ul id="search_product" class="order-item my-simple-gallery" itemscope>

          </ul>
        </div>
      </div><!--search_result-->
      
    </div>
  </div><!-- /content -->
  <div class="footer">
<p>© <?php echo isset($copyright) ? $copyright:'外賣店名稱'?> .Created with <a href="#" title="PopFree Tech" target="_blank">PopFree Tech</a></p>  </div><!-- /footer -->
</div>
<!-- 訂單查詢結束 -->
    
<!--load pswp-->
<div class="pswp" tabhome="-1" role="dialog" aria-hidden="true"> 
  <div class="pswp__bg"></div>
  <div class="pswp__scroll-wrap"> 
    <div class="pswp__container">
      <div class="pswp__item"></div>
      <div class="pswp__item"></div>
      <div class="pswp__item"></div>
    </div>
    <div class="pswp__ui pswp__ui--hidden">
      <div class="pswp__top-bar"> 
        <div class="pswp__counter"></div>
        <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
        <button class="pswp__button pswp__button--share" title="Share"></button>
        <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
        <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
        <div class="pswp__preloader">
          <div class="pswp__preloader__icn">
            <div class="pswp__preloader__cut">
              <div class="pswp__preloader__donut"></div>
            </div>
          </div>
        </div>
      </div>
      <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
        <div class="pswp__share-tooltip"></div>
      </div>
      <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"> </button>
      <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"> </button>
      <div class="pswp__caption">
        <div class="pswp__caption__center"></div>
      </div>
    </div>
  </div>
</div>
<!--load pswp end-->
<input type="hidden" name="" value="<?php echo base_url('home/getCartList')?>" id="_get_cartList">
<input type="hidden" name="" value="<?php echo base_url('home/addCart');?>" id="_add_cart">
<input type="hidden" name="" value="<?php echo base_url('home/popupSpecItem')?>" id="_popup_spec_item">
<!--slideshow end-->
<link rel="stylesheet" href="<?=base_url('themes/front/js/datetime/DateTimePicker.min.css')?>"> 
<script src="<?=base_url('themes/front/js/datetime/DateTimePicker.min.js')?>"></script>
<!--gallery grid-->
<!-- Core CSS file -->
<link rel="stylesheet" href="<?=base_url('themes/front/js/photoswipe/photoswipe.css')?>"> 
<link rel="stylesheet" href="<?=base_url('themes/front/js/photoswipe/default-skin/default-skin.css')?>"> 
<!-- Core JS file -->
<script src="<?=base_url('themes/front/js/photoswipe/photoswipe.min.js')?>"></script> 
<!-- UI JS file -->
<script src="<?=base_url('themes/front/js/photoswipe/photoswipe-ui-default.js')?>"></script> 
<!--gallery grid end-->
<script src="<?=base_url('themes/front/js/application.js')?>"></script>

<script>
var jsonData = null;
var selectdSpecKey = null;
var nowCarts = <?php echo json_encode($carts);?>;
</script>
<script src="<?=base_url('themes/front/js/base.js')?>"></script>
</body>
</html>
